# Author: Mr.Xu
# @Time : 2019/11/27 19:07

# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "luffyapi.settings.dev")
# django.setup()

# from utils import logging
# logging.logger.info("123")


'''
短信测试
'''

# # 短信应用 SDK AppID
# APPID = 1400290626
# # 短信应用 APPKEY
# APPKEY = "9c4175487b41b699df1cfe0f36f826be"
# # 短信模板ID，需要在短信控制台中申请
# TEMPLATE_ID = 486243  # NOTE: 这里的模板 ID`7839`只是示例，真实的模板 ID 需要在短信控制台中申请
# # 签名
# SMS_SIGN = "CeciliaMZ"  # NOTE: 签名参数使用的是`签名内容`，而不是`签名ID`。这里的签名"腾讯云"只是示例，真实的签名需要在短信控制台中  # NOTE: # 短信应用 SDK AppKey
#
# from qcloudsms_py import SmsSingleSender
#
# # 获取发送用户
# ssender = SmsSingleSender(APPID, APPKEY)
#
# params = ["5678",5]  # 当模板没有参数时，`params = []`
#
# phone_numbers = ["17355439811"]
# try:
#     result = ssender.send_with_param(86, phone_numbers[0],
#                                      TEMPLATE_ID, params, sign=SMS_SIGN, extend="", ext="")
#     print(result)
# except Exception as e:
#     print(e)



from libs import tx_sms

code = tx_sms.get_code()
result = tx_sms.send_sms('17355439811', code, 5)
print(result)
print(code)